home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
comm
/
mail
/
rmail.lha
/
rmail
/
rmail.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-28
|
706b
|
59 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* buffer size for incoming mail */
#define RMAIL_BUF_SIZE 16000
main(int argc, char **argv)
{
char c,*buf;
FILE
*out;
/* check args */
if (argc != 2)
{
printf("usage: rmail user\n\n");
return 0;
}
/* allocate buffer */
buf = malloc( RMAIL_BUF_SIZE );
/* generate filename */
sprintf(buf,"uumail:%s", argv[1]);
/* open file */
out = fopen(buf,"a");
/* wipe out the buffer */
memset(buf, '\0', RMAIL_BUF_SIZE );
/* set file buffering mode */
setbuf(out, buf);
/* append stdin to mailbox file */
while ((c=getchar()) != EOF)
fputc(c,out);
/* free memory */
free(buf);
/* close file */
fclose(out);
return 0;
}